<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>查找最大值和最小值</title>
</head>
<body>
<script>
    var arr=[23,534,79,90,1000,12,43,96,-1,2000];
    var min=max=arr[0];
    for(var i=0;i<arr.length;i++){
        if(arr[i]<min){
            min=arr[i]
        }
        if (arr[i]>max){
            max=arr[i]
        }
    }
    document.write(arr+"<br />");
    document.write("最小值"+min+"<br />");
    document.write("最大值"+max);
</script>
</body>
</html>